define(function(require, exports, module) {

  var common = require('common');

  var View = require('main/admin/core/Form').extend({
    template: require('main/admin/timesheet/view/form.handlebars'),
    prepareViewData: function() {
      this.viewData = {
        model: this.model.toJSON(),
        label: common.timesheet.label,
        placeholder: common.timesheet.placeholder
      };
    },
    afterRender: function() {
      var that = this;
      this.$el.find('#datepicker').daterangepicker({
        format: common.format.moment.date,
        singleDatePicker: true
      }, function(start, end) {
        that.$el.find('#today').val(start.format(common.format.moment.date));
      });

      this.$el.find(".timepicker").timepicker({
        showInputs: false,
        showMeridian: false
      });
    },
    prepareSubmitData: function() {
      var data = $(this.el).serializeJSON();
      this.submitData = {
        todoid: data.todoid,
        detail: data.detail,
        today: data.today,
        from: data.from,
        to: data.to,
        hours: data.hours
      };
    }
  });

  module.exports = function(options) {
    return ( new View(options) );
  }
});